﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace Identity.Mapping
{
    public class VendorMapping : IEntityTypeConfiguration<Vendor>

    {
        public void Configure(EntityTypeBuilder<Vendor> builder)
        {
            builder.HasKey(_ => _.Id);
            builder.Property(_ => _.Id).ValueGeneratedOnAdd();
            builder.Property(_ => _.Name).HasMaxLength(128);

            builder.Property(_ => _.Contact).HasMaxLength(24);
            builder.Property(_ => _.ContactPhone).HasMaxLength(24);
            builder.Property(_ => _.Address).HasMaxLength(64);
            builder.Property(_ => _.TaxNumber).HasMaxLength(64);
            builder.Property(_ => _.Bank).HasMaxLength(24);
            builder.Property(_ => _.BankAccount).HasMaxLength(64);
            builder.Property(_ => _.FullName);

            builder.HasIndex(_ => _.Name);
            builder.ToTable("fee_Vendor");
        }
    }
}